<?php

namespace app\common\model;



use app\common\logic\AppLogic;



class BannerModel extends CommonModel{

    protected  $name = 'beautiful_banner';

    protected  $pk   = 'banner_id';


    /**
     * 模型写入前事件（钩子函数）
     */
    public static function onBeforeInsert($model)
    {
        $model->set("add_time", date('Y-m-d'));
        $model->set("add_ip", request()->ip());
    }
    public function link(){

        return  $this->hasOne(BannerLinkModel::class,'link_url_id','link_url_id');

    }
}

